package com.rao.gmall.web.all.controller;

import com.rao.gmall.model.vo.IndexCategoryVo;
import com.rao.gmall.web.all.service.IndexService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

import java.util.List;

/**
 * @author nzmxfan
 * @create 2021-08-12-23:12
 */
@Controller
public class IndexController {

    @Autowired
    IndexService indexService;

    @GetMapping("/")
    public String getAllCategorysForIndexHtml(Model model){
        // 获取 所有的分级列表集合
        List<IndexCategoryVo> categorys = indexService.getAllCategorysForIndexHtml();
        model.addAttribute("list", categorys);
        return "index/index";
    }
}
